package com.yuven.baselib.utils;


import android.graphics.drawable.Drawable;
import android.os.Build;

import androidx.annotation.ArrayRes;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.StringRes;

/**
 * 资源工具类
 *
 * @author :        Yuven
 * @date :          6/16/21 9:09 AM
 * @desc :
 */
public class ResourceUtil {

    public static Drawable getDrawable(@StringRes int resId) {
        return ToolsKit.getClient().getResources().getDrawable(resId);
    }

    public static String getString(@StringRes int resId) {
        return ToolsKit.getClient().getResources().getString(resId);
    }

    public static String getString(@StringRes int resId, Object... objects) {
        return ToolsKit.getClient().getResources().getString(resId, objects);
    }

    public static String[] getStringArray(@ArrayRes int resId) {
        return ToolsKit.getClient().getResources().getStringArray(resId);
    }

    @ColorInt
    public static int getColor(@ColorRes int resId) {
        if (Build.VERSION.SDK_INT >= 23) {
            return ToolsKit.getClient().getColor(resId);
        } else {
            return ToolsKit.getClient().getResources().getColor(resId);
        }
    }
}
